﻿@{
    ViewBag.Title = "编辑楼层信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
    <script src="/resources/scripts/ajaxfileupload.js"></script>
    <script type="text/javascript">
        new AjaxUpload($("#aFile"), {
            action: '/MallAreas/FileUpLoadFile',
            data: {
                folderName: "Areas"
            },
            name: 'UploadImg',
            responseType: "json",
            onSubmit: function (file, extension) {
                //$(".file-list > ul").html("<li style='text-align:center; padding-right:5px; background:none;border:none;color:#f00;font-size:12px;'><img src='/res/images/big_load.gif' width='16'>上传中...</li>");
            },
            onComplete: function (file, data) {
                if (data.Value) {
                    $("#ImgShow").attr("src", data.result[0]);
                    $("#ImgUrl").val(data.result[0]);
                }
                else {
                    alert("上传失败。");
                }
            }
        });
    </script>
}

@using AFT.Parking.Entity;
@model MallArea
<div class="content-box">
    <!-- Start Content Box -->
    <div class="content-box-header">
        <h3>编辑楼层信息</h3>
        <div class="clear"></div>
    </div>
    <!-- End .content-box-header -->
    <div class="content-box-content">

        <div class="tab-content default-tab" id="tab2">
            <form method="post" id="frm">
                <fieldset>
                    <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                    @Html.Hidden("ParkingId", Model.ParkingId)
                    <p>
                        <label>停车场名称</label>
                        @ViewBag.ParkingName
                    </p>
                    <p>
                        <label>启用</label>
                        @Html.CheckBox("IsEnable", Model.IsEnable)
                    </p>
                    <p>
                        <label>楼层名称</label>
                        @Html.TextBox("Name", Model.Name, new { @class = "text-input small-input" })
                    </p>
                    <p>
                        <label>比例</label>
                        @Html.TextBox("Scale", Model.Scale, new { @class = "text-input small-input" })
                        <br />
                        <small>单位：米，输入小数或者整数，表示1像素与该数值的比例(px:m)。</small>
                    </p>
                    <p>
                        <label>区域图片</label>
                        <a href="javascript:void(0)" id="aFile">上传图片</a>
                        <br />
                        <img id="ImgShow" name="ImgShow" src="@Model.ImgUrl" width="200px" height="150px" />
                        @Html.Hidden("ImgUrl", Model.ImgUrl)
                    </p>
                    <p>
                        <input class="button" type="submit" id="btnSubmit" value=" 保 存 " />
                        <input class="button" type="button" id="btnBack" value=" 返 回 " /> <br />
                        <span class="input-notification @ViewBag.Icon png_bg">@ViewBag.Message</span>
                        <input type="hidden" id="hd_backUrl" value="/mallAreas/floors/@Model.ParkingId">
                    </p>
                </fieldset>
                <div class="clear"></div>
                <script type="text/javascript">
                    new AjaxUpload($("#aFile"), {
                        action: '/MallAreas/FileUpLoadFile',
                        data: {
                            folderName: "Areas"
                        },
                        name: 'UploadImg',
                        responseType: "json",
                        onSubmit: function (file, extension) {
                        },
                        onComplete: function (file, data) {
                            console.log(data);
                            if (data.Value) {
                                $("#ImgShow").attr("src", data.Result[0]);
                                $("#ImgUrl").val(data.Result[0]);
                            }
                            else {
                                alert("上传失败。");
                            }
                        }
                    });

                </script>
                <!-- End .clear -->
            </form>
        </div>
        <!-- End #tab2 -->
    </div>
    <!-- End .content-box-content -->
</div>


